/**
 * 功能:一键开启背包位置
 * From:芬芬时尚潮流
 */
var 装备栏 = "#fUI/UIWindow.img/Item/Tab/enabled/0#"; //红心
var 消耗栏 = "#fUI/UIWindow.img/Item/Tab/enabled/1#"; //红心
var 其他栏 = "#fUI/UIWindow.img/Item/Tab/enabled/2#"; //红心
var 设置栏 = "#fUI/UIWindow.img/Item/Tab/enabled/3#"; //红心
var 特殊栏 = "#fUI/UIWindow.img/Item/Tab/enabled/4#"; //红心
var status = 0;
var 灰色扩展 = "#fItem/0911.img/9111000.icon#"; //红心
//开通需要的积分
var energy = 10000;
//开通需要的活跃
var points = 10000;

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (status == 0 && mode == 0) {
		cm.dispose();
		return;
	}
	if (mode == 1) {
		status++;
	} else {
		status--;
	}
	if (cm.getMapId() == 180000001 || cm.getMapId() == 910340000) {
		cm.sendOk("很遗憾，您因为在特殊地图无法使用此功能.")
		cm.dispose();
	} else if (status == 0) {
		var selStr = " #e#rPPMS特殊服务处\r\n\#e#k 我可以为您提供以下服务哟#n\r\n";
		selStr += "#L0#" + 灰色扩展 + 装备栏+"#n(使用金币拓展装备栏)#l\r\n\r\n";
		selStr += "#L1#" + 灰色扩展 + 消耗栏+"#n(使用金币拓展消耗栏)#l\r\n\r\n";
		selStr += "#L2#" + 灰色扩展 + 其他栏+"#n(使用金币拓展其他栏)#l\r\n\r\n";
		selStr += "#L3#" + 灰色扩展 + 设置栏+"#n(使用金币拓展设置栏)#l\r\n\r\n";
		selStr += "#L4#" + 灰色扩展 + 特殊栏+"#n(使用金币拓展特殊栏)#l\r\n\r\n";
		cm.sendSimple(selStr);
	} else if (status == 1) {
		switch (selection) {
		case 0: //装备栏
			if (cm.getSlotLimit(1) >= 128) {
				cm.sendOk("你选择的栏已经全部开通了,没必要在开了");
				cm.dispose();
				return;
			}
			if (cm.getPlayerEnergy() >= energy && cm.getPlayerPoints() >= points) {
				cm.gainPlayerEnergy(-energy);
				cm.gainPlayerPoints(-points);
				cm.SlotFull(1);
				cm.sendOk("恭喜您,操作成功.已经成功开启所有栏目");
			} else {
				cm.sendOk("请确认是否有足够的PPMS活跃值和积分值.\r\n\r\n开通需要" + energy + "点 PPMS微积分 + " + points + "点PPMSPPMS活跃值\r\n\r\n您当前的PPMS活跃值:" + cm.getPlayerPoints() + "点 PPMS微积分:" + cm.getPlayerEnergy() + "点\r\n");
			}
			cm.dispose();
			break;
		case 1: //消耗栏
			if (cm.getSlotLimit(2) >= 128) {
				cm.sendOk("你选择的栏已经全部开通了,没必要在开了");
				cm.dispose();
				return;
			}
			if (cm.getPlayerEnergy() >= energy && cm.getPlayerPoints() >= points) {
				cm.gainPlayerEnergy(-energy);
				cm.gainPlayerPoints(-points);
				cm.SlotFull(2);
				cm.sendOk("恭喜您,操作成功.已经成功开启所有栏目");
			} else {
				cm.sendOk("请确认是否有足够的PPMS活跃值和积分值.\r\n\r\n开通需要" + energy + "点 PPMS微积分 + " + points + "点PPMS活跃值\r\n\r\n您当前的PPMS活跃值:" + cm.getPlayerPoints() + "点 PPMS微积分:" + cm.getPlayerEnergy() + "点\r\n");
			}
			cm.dispose();
			break;
		case 2: //设置栏
			if (cm.getSlotLimit(3) >= 128) {
				cm.sendOk("你选择的栏已经全部开通了,没必要在开了");
				cm.dispose();
				return;
			}
			if (cm.getPlayerEnergy() >= energy && cm.getPlayerPoints() >= points) {
				cm.gainPlayerEnergy(-energy);
				cm.gainPlayerPoints(-points);
				cm.SlotFull(3);
				cm.sendOk("恭喜您,操作成功.已经成功开启所有栏目");
			} else {
				cm.sendOk("请确认是否有足够的PPMS活跃值和积分值.\r\n\r\n开通需要" + energy + "点 PPMS微积分 + " + points + "点PPMS活跃值\r\n\r\n您当前的PPMS活跃值:" + cm.getPlayerPoints() + "点 PPMS微积分:" + cm.getPlayerEnergy() + "点\r\n");
			}
			cm.dispose();
			break;
		case 3: //其他
			if (cm.getSlotLimit(4) >= 128) {
				cm.sendOk("你选择的栏已经全部开通了,没必要在开了");
				cm.dispose();
				return;
			}
			if (cm.getPlayerEnergy() >= energy && cm.getPlayerPoints() >= points) {
				cm.gainPlayerEnergy(-energy);
				cm.gainPlayerPoints(-points);
				cm.SlotFull(4);
				cm.sendOk("恭喜您,操作成功.已经成功开启所有栏目");
			} else {
				cm.sendOk("请确认是否有足够的PPMS活跃值和积分值.\r\n\r\n开通需要" + energy + "点 PPMS微积分 + " + points + "点PPMS活跃值\r\n\r\n您当前的PPMS活跃值:" + cm.getPlayerPoints() + "点 PPMS微积分:" + cm.getPlayerEnergy() + "点\r\n");
			}
			cm.dispose();
			break;
		case 4:
			if (cm.getSlotLimit(5) >= 128) {
				cm.sendOk("你选择的栏已经全部开通了,没必要在开了");
				cm.dispose();
				return;
			}
			if (cm.getPlayerEnergy() >= energy && cm.getPlayerPoints() >= points) {
				cm.gainPlayerEnergy(-energy);
				cm.gainPlayerPoints(-points);
				cm.SlotFull(5);
				cm.sendOk("恭喜您,操作成功.已经成功开启所有栏目");
			} else {
				cm.sendOk("请确认是否有足够的PPMS活跃值和积分值.\r\n\r\n开通需要" + energy + "点 PPMS微积分 + " + points + "点PPMS活跃值\r\n\r\n您当前的PPMS活跃值:" + cm.getPlayerPoints() + "点 PPMS微积分:" + cm.getPlayerEnergy() + "点\r\n");
			}
			cm.dispose();
			break;

		}
	}
}
